﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TestUI : PanelCommon
{
    public Camera mainCam;

    public Transform finger;
    
    // Start is called before the first frame update
    void Start()
    {
        base.Start();
            finger.gameObject.SetActive(true);
    }

    // Update is called once per frame
    void Update()
    {
      if (finger)
            {
                    
                Vector3 screenPos = Input.mousePosition;
                finger.transform.GetComponent<RectTransform>().SetUIPosition(PanelCommon.uiCamera.ScreenToWorldPoint(screenPos));
            }
                
            if (Input.GetMouseButton(0))
            {
                finger.transform.localScale = Vector3.Lerp(finger.transform.localScale,0.8f*Vector3.one,.4f);
            }
            else
            {
                finger.transform.localScale = Vector3.Lerp(finger.transform.localScale,1.0f*Vector3.one,.4f);
                //if (finger && finger.activeSelf)
                //    finger.SetActive(false);
            }
    }
    
}
